
window.onload = function () {
    showUser();
    showChannel();
}

function showUser() {
    axios.get("/user/getUser").then(resp => {
        let info = resp.data;
        $("usernameSpan").innerHTML = info.username;
        $("emailSpan").innerHTML = info.email;
        $("faceImg").src = "/face/" + info.imgPath
    });
}

function showChannel() {
    axios.get("/channel/findAll").then(resp => {
        let info = resp.data;
        let str = "";
        info.forEach(n => {
            str += `<tr><td><a href="/channel.html?id=${n.id}&">${n.name}</a></td>
                        <td>${n.describe}</td>
                        <td>${n.themeNum}</td>
                     </tr>`;
        });

        $("data").innerHTML = str;
    });
}

